# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=plasma-nm
pkgver=5.27.10
pkgrel=0
pkgdesc="Plasma applet written in QML for managing network connections"
# armhf blocked by qt5-qtdeclarative
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="(LGPL-2.1-only OR LGPL-3.0-only) AND LGPL-2.0-or-later"
depends="
	kirigami2
	networkmanager
	"
makedepends="
	extra-cmake-modules
	kcmutils5-dev
	kcompletion5-dev
	kconfigwidgets5-dev
	kcoreaddons5-dev
	kdbusaddons5-dev
	kdeclarative5-dev
	ki18n5-dev
	kiconthemes5-dev
	kio5-dev
	knotifications5-dev
	kservice5-dev
	kwallet5-dev
	kwidgetsaddons5-dev
	kwindowsystem5-dev
	mobile-broadband-provider-info
	modemmanager-qt5-dev
	networkmanager-qt5-dev
	plasma-framework5-dev
	prison5-dev
	qca-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	samurai
	solid5-dev
	"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/plasma-nm.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/plasma-nm-$pkgver.tar.xz"
subpackages="$pkgname-lang $pkgname-mobile"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_MOBILE=ON
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

mobile() {
	pkgdesc="$pkgdesc (mobile KCM's)"
	depends="$depends $pkgname"

	amove usr/share/kpackage
	amove usr/lib/qt5/plugins/kcms
}

sha512sums="
427e6b8ebcd471c0e09a483e43207e60367dae45f8d7727101559685fb9e8f5eaa1a6328a5fd6af4f0a39e7533495ed5402f2f34be9fa943099906d092b1739d  plasma-nm-5.27.10.tar.xz
"
